﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Game_Fly.Code
{
    public class LifePrize
    {
        //1.字段变量：xy坐标，小兵背景，boss背景，游戏阶段，背景移动速度
        int x;
        int y;
        Image image;
        int count;//生产敌机1的数量
        int output;//生产敌机1的血量
        int speed;//敌机1的移动速度
        int beHitCount;//当前敌机被击中次数
        int width;
        int height;
        //2.属性方法
        public int X
        {
            set { x = value; }
            get { return x; }
        }
        public int Y
        {
            set { y = value; }
            get { return y; }
        }
        public int Count
        {
            set { count = value; }
            get { return count; }
        }
        public int Output
        {
            set { output = value; }
            get { return output; }
        }
        public int Width
        {
            set { width = value; }
            get { return width; }
        }
        public int Height
        {
            set { height = value; }
            get { return height; }
        }
        public int BeHitCount
        {
            set { beHitCount = value; }
            get { return beHitCount; }
        }
        //3.构造方法
        public LifePrize()
        {
            image = GameImage.Life;
            count = 5000;//每隔多久生产一次飞机
            output = 1;//血量
            speed = 2;
            beHitCount = 0;
            x = 0;//随机产生x点;
            y = 0;
            width = image.Width;
            height = image.Height;
        }

        //4.特征方法
        public void Draw(Graphics g)
        {
            g.DrawImage(image, x, y);
        }

        public void Update(int frame)
        {
            y += speed;
            //判断敌机是否超出边界
            if (y >= GameUI.GameForm.ClientSize.Height - height)
                GameUI.ListLifePrize.Remove(this);
        }
    }
}
